﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using Touch2Like.DAL;
using Touch2Like.Model;

namespace Touch2Like.Web.Admin.Popup
{
    public partial class AddTag : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                //if (!string.IsNullOrEmpty(Request["ListID"]))
                //{
                //    Tag tag = new Tag();
                //    TagInfo info = tag.GetByID(Convert.ToInt32(Request["ListID"]));

                //    if (info != null)
                //    {
                //        tb_TagUID.Text = info.TagUID;
                //        tb_Alias.Text = info.Alias;
                //        tb_Customer.Text = info.UserID.ToString();
                //        tb_ServiceURL.Text = info.ServiceURL;
                //    }
                //}
            }
        }

        protected void btn_Submit_Click(object sender, EventArgs e)
        {
            UserTagDAL tag = new UserTagDAL();
            UserTagInfo info = new UserTagInfo();

            info.TagUID = tb_TagUID.Text.Trim();
            info.Alias = tb_Alias.Text.Trim();
            //info.UserID = Convert.ToInt32(tb_Customer.Text.Trim());
            //info.ServiceURL = tb_ServiceURL.Text.Trim();

            //if (!string.IsNullOrEmpty(Request["ListID"]))
            //{
            //    info.ListID = Convert.ToInt32(Request["ListID"]);
            //    tag.Update(info);
            //}
            //else
            //{
            //    tag.Add(info);
            //}

            ClientScript.RegisterStartupScript(this.GetType(), "update", "<script>top.document.location.href=top.document.location.href;top.document.location.reload();</script>");
        }
    }
}